public class Main {

    public static void main(String[] args) {

        //静态代理
        UserImpl target = new UserImpl();

        UserProxy proxy = new UserProxy(target);

        proxy.save();

        //jdk动态代理
        UserDao target2 = new UserImpl();

        System.out.println(target.getClass());

        UserDao proxy2 = (UserDao) new ProxyFactory(target2).getProxyFactory();

        System.out.println(proxy2.getClass());

        proxy2.save();

    }
}
